home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / ms11_srv.zip / CLIENT.QC < prev    next >
Text File  |  1996-08-01  |  36KB  |  1,473 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float    modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float    intermission_running;
  21. float    intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35. // remove items
  36.     self.items = self.items - (self.items & 
  37.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  38.     
  39. // cap super health
  40.     if (self.health > 100)
  41.         self.health = 100;
  42.     if (self.health < 50)
  43.         self.health = 50;
  44.     parm1 = self.items;
  45.     parm2 = self.health;
  46.     parm3 = self.armorvalue;
  47.     if (self.ammo_shells < 25)
  48.         parm4 = 25;
  49.     else
  50.         parm4 = self.ammo_shells;
  51.     parm5 = self.ammo_nails;
  52.     parm6 = self.ammo_rockets;
  53.     parm7 = self.ammo_cells;
  54.     parm8 = self.weapon;
  55.     parm9 = self.armortype * 100;
  56. };
  57.  
  58. void() SetNewParms =
  59. {
  60.     parm1 = IT_SHOTGUN | IT_AXE;
  61.     parm2 = 100;
  62.     parm3 = 0;
  63.     parm4 = 25;
  64.     parm5 = 0;
  65.     parm6 = 0;
  66.     parm6 = 0;
  67.     parm8 = 1;
  68.     parm9 = 0;
  69. };
  70.  
  71. void() DecodeLevelParms =
  72. {
  73.     if (serverflags)
  74.     {
  75.         if (world.model == "maps/start.bsp")
  76.             SetNewParms ();        // take away all stuff on starting new episode
  77.     }
  78.     
  79.     self.items = parm1;
  80.     self.health = parm2;
  81.     self.armorvalue = parm3;
  82.     self.ammo_shells = parm4;
  83.     self.ammo_nails = parm5;
  84.     self.ammo_rockets = parm6;
  85.     self.ammo_cells = parm7;
  86.     self.weapon = parm8;
  87.     self.armortype = parm9 * 0.01;
  88. };
  89.  
  90. /*
  91. ============
  92. FindIntermission
  93.  
  94. Returns the entity to view from
  95. ============
  96. */
  97. entity() FindIntermission =
  98. {
  99.     local    entity spot;
  100.     local    float cyc;
  101.  
  102. // look for info_intermission first
  103.     spot = find (world, classname, "info_intermission");
  104.     if (spot)
  105.     {    // pick a random one
  106.         cyc = random() * 4;
  107.         while (cyc > 1)
  108.         {
  109.             spot = find (spot, classname, "info_intermission");
  110.             if (!spot)
  111.                 spot = find (spot, classname, "info_intermission");
  112.             cyc = cyc - 1;
  113.         }
  114.         return spot;
  115.     }
  116.  
  117. // then look for the start position
  118.     spot = find (world, classname, "info_player_start");
  119.     if (spot)
  120.         return spot;
  121.     
  122. // testinfo_player_start is only found in regioned levels
  123.     spot = find (world, classname, "testplayerstart");
  124.     if (spot)
  125.         return spot;
  126.     
  127.     objerror ("FindIntermission: no spot");
  128. };
  129.  
  130.  
  131. string nextmap;
  132. void() GotoNextMap =
  133. {
  134.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  135.         changelevel (mapname);
  136.     else
  137.         changelevel (nextmap);
  138. };
  139.  
  140.  
  141. void() ExitIntermission =
  142. {
  143. // skip any text in deathmatch
  144.     if (deathmatch)
  145.     {
  146.         GotoNextMap ();
  147.         return;
  148.     }
  149.     
  150.     intermission_exittime = time + 1;
  151.     intermission_running = intermission_running + 1;
  152.  
  153. //
  154. // run some text if at the end of an episode
  155. //
  156.     if (intermission_running == 2)
  157.     {
  158.         if (world.model == "maps/e1m7.bsp")
  159.         {
  160.             WriteByte (MSG_ALL, SVC_CDTRACK);
  161.             WriteByte (MSG_ALL, 2);
  162.             WriteByte (MSG_ALL, 3);
  163.             if (!cvar("registered"))
  164.             {
  165.                 WriteByte (MSG_ALL, SVC_FINALE);
  166.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  167.             }
  168.             else
  169.             {
  170.                 WriteByte (MSG_ALL, SVC_FINALE);
  171.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  172.             }
  173.             return;
  174.         }
  175.         else if (world.model == "maps/e2m6.bsp")
  176.         {
  177.             WriteByte (MSG_ALL, SVC_CDTRACK);
  178.             WriteByte (MSG_ALL, 2);
  179.             WriteByte (MSG_ALL, 3);
  180.  
  181.             WriteByte (MSG_ALL, SVC_FINALE);
  182.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  183.             return;
  184.         }
  185.         else if (world.model == "maps/e3m6.bsp")
  186.         {
  187.             WriteByte (MSG_ALL, SVC_CDTRACK);
  188.             WriteByte (MSG_ALL, 2);
  189.             WriteByte (MSG_ALL, 3);
  190.  
  191.             WriteByte (MSG_ALL, SVC_FINALE);
  192.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  193.             return;
  194.         }
  195.         else if (world.model == "maps/e4m7.bsp")
  196.         {
  197.             WriteByte (MSG_ALL, SVC_CDTRACK);
  198.             WriteByte (MSG_ALL, 2);
  199.             WriteByte (MSG_ALL, 3);
  200.  
  201.             WriteByte (MSG_ALL, SVC_FINALE);
  202.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  203.             return;
  204.         }
  205.  
  206.         GotoNextMap();
  207.     }
  208.     
  209.     if (intermission_running == 3)
  210.     {
  211.         if (!cvar("registered"))
  212.         {    // shareware episode has been completed, go to sell screen
  213.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  214.             return;
  215.         }
  216.         
  217.         if ( (serverflags&15) == 15)
  218.         {
  219.             WriteByte (MSG_ALL, SVC_FINALE);
  220.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  221.             return;
  222.         }
  223.         
  224.     }
  225.  
  226.     GotoNextMap();
  227. };
  228.  
  229. /*
  230. ============
  231. IntermissionThink
  232.  
  233. When the player presses attack or jump, change to the next level
  234. ============
  235. */
  236. void() IntermissionThink =
  237. {
  238.     if (time < intermission_exittime)
  239.         return;
  240.  
  241.     if (!self.button0 && !self.button1 && !self.button2)
  242.         return;
  243.     
  244.     ExitIntermission ();
  245. };
  246.  
  247. void() execute_changelevel =
  248. {
  249.     local entity    pos;
  250.  
  251.     intermission_running = 1;
  252.     
  253. // enforce a wait time before allowing changelevel
  254.     if (deathmatch)
  255.         intermission_exittime = time + 5;
  256.     else
  257.         intermission_exittime = time + 2;
  258.  
  259.     WriteByte (MSG_ALL, SVC_CDTRACK);
  260.     WriteByte (MSG_ALL, 3);
  261.     WriteByte (MSG_ALL, 3);
  262.     
  263.     pos = FindIntermission ();
  264.  
  265.     other = find (world, classname, "player");
  266.     while (other != world)
  267.     {
  268.         other.view_ofs = '0 0 0';
  269.         other.angles = other.v_angle = pos.mangle;
  270.         other.fixangle = TRUE;        // turn this way immediately
  271.         other.nextthink = time + 0.5;
  272.         other.takedamage = DAMAGE_NO;
  273.         other.solid = SOLID_NOT;
  274.         other.movetype = MOVETYPE_NONE;
  275.         other.modelindex = 0;
  276.         setorigin (other, pos.origin);
  277.         other = find (other, classname, "player");
  278.     }    
  279.  
  280.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  281. };
  282.  
  283.  
  284. void() changelevel_touch =
  285. {
  286.     local entity    pos;
  287.  
  288.     if (other.classname != "player")
  289.         return;
  290.  
  291.     if (cvar("noexit"))
  292.     {
  293.         T_Damage (other, self, self, 50000);
  294.         return;
  295.     }
  296.     bprint (other.netname);
  297.     bprint (" exited the level\n");
  298.     
  299.     nextmap = self.map;
  300.  
  301.     SUB_UseTargets ();
  302.  
  303.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  304.     {    // NO_INTERMISSION
  305.         GotoNextMap();
  306.         return;
  307.     }
  308.     
  309.     self.touch = SUB_Null;
  310.  
  311. // we can't move people right now, because touch functions are called
  312. // in the middle of C movement code, so set a think time to do it
  313.     self.think = execute_changelevel;
  314.     self.nextthink = time + 0.1;
  315. };
  316.  
  317. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  318. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  319. */
  320. void() trigger_changelevel =
  321. {
  322.     if (!self.map)
  323.         objerror ("chagnelevel trigger doesn't have map");
  324.     
  325.     InitTrigger ();
  326.     self.touch = changelevel_touch;
  327. };
  328.  
  329.  
  330. /*
  331. =============================================================================
  332.  
  333.                 PLAYER GAME EDGE FUNCTIONS
  334.  
  335. =============================================================================
  336. */
  337.  
  338. void() set_suicide_frame;
  339.  
  340. // called by ClientKill and DeadThink
  341. void() respawn =
  342. {
  343.     if (coop)
  344.     {
  345.         // make a copy of the dead body for appearances sake
  346.         CopyToBodyQue (self);
  347.         // get the spawn parms as they were at level start
  348.         setspawnparms (self);
  349.         // respawn        
  350.         PutClientInServer ();
  351.     }
  352.     else if (deathmatch)
  353.     {
  354.         // make a copy of the dead body for appearances sake
  355.         CopyToBodyQue (self);
  356.         // set default spawn parms
  357.         SetNewParms ();
  358.         // respawn        
  359.         PutClientInServer ();
  360.     }
  361.     else
  362.     {    // restart the entire server
  363.         localcmd ("restart\n");
  364.     }
  365. };
  366.  
  367.  
  368. /*
  369. ============
  370. ClientKill
  371.  
  372. Player entered the suicide command
  373. ============
  374. */
  375. void() ClientKill =
  376. {
  377.     bprint (self.netname);
  378.     bprint (" suicides\n");
  379.     set_suicide_frame ();
  380.     self.modelindex = modelindex_player;
  381.     self.frags = self.frags - 2;    // extra penalty
  382.     respawn ();
  383. };
  384.  
  385. float(vector v) CheckSpawnPoint =
  386. {
  387.     return FALSE;
  388. };
  389.  
  390. /*
  391. ============
  392. SelectSpawnPoint
  393.  
  394. Returns the entity to spawn at
  395. ============
  396. */
  397. entity() SelectSpawnPoint =
  398. {
  399.     local    entity spot;
  400.     
  401. // testinfo_player_start is only found in regioned levels
  402.     spot = find (world, classname, "testplayerstart");
  403.     if (spot)
  404.         return spot;
  405.         
  406. // choose a info_player_deathmatch point
  407.     if (coop)
  408.     {
  409.         lastspawn = find(lastspawn, classname, "info_player_coop");
  410.         if (lastspawn == world)
  411.             lastspawn = find (lastspawn, classname, "info_player_start");
  412.         if (lastspawn != world)
  413.             return lastspawn;
  414.     }
  415.     else if (deathmatch)
  416.     {
  417.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  418.         if (lastspawn == world)
  419.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  420.         if (lastspawn != world)
  421.             return lastspawn;
  422.     }
  423.  
  424.     if (serverflags)
  425.     {    // return with a rune to start
  426.         spot = find (world, classname, "info_player_start2");
  427.         if (spot)
  428.             return spot;
  429.     }
  430.     
  431.     spot = find (world, classname, "info_player_start");
  432.     if (!spot)
  433.         error ("PutClientInServer: no info_player_start on level");
  434.     
  435.     return spot;
  436. };
  437.  
  438. /*
  439. ===========
  440. PutClientInServer
  441.  
  442. called each time a player is spawned
  443. ============
  444. */
  445. void() DecodeLevelParms;
  446. void() PlayerDie;
  447.  
  448.  
  449. void() PutClientInServer =
  450. {
  451.     local    entity spot;
  452.  
  453.     self.classname = "player";
  454.     self.health = 100;
  455.     self.takedamage = DAMAGE_AIM;
  456.     self.solid = SOLID_SLIDEBOX;
  457.     self.movetype = MOVETYPE_WALK;
  458.     self.show_hostile = 0;
  459.     self.max_health = 100;
  460.     self.flags = FL_CLIENT;
  461.     self.air_finished = time + 12;
  462.     self.dmg = 2;           // initial water damage
  463.     self.super_damage_finished = 0;
  464.     self.radsuit_finished = 0;
  465.     self.invisible_finished = 0;
  466.     self.invincible_finished = 0;
  467.     self.effects = 0;
  468.     self.invincible_time = 0;
  469.  
  470.     DecodeLevelParms ();
  471.     
  472.     W_SetCurrentAmmo ();
  473.  
  474.     self.attack_finished = time;
  475.     self.th_pain = player_pain;
  476.     self.th_die = PlayerDie;
  477.     
  478.     self.deadflag = DEAD_NO;
  479. // paustime is set by teleporters to keep the player from moving a while
  480.     self.pausetime = 0;
  481.     
  482.     spot = SelectSpawnPoint ();
  483.  
  484.     self.origin = spot.origin + '0 0 1';
  485.     self.angles = spot.angles;
  486.     self.fixangle = TRUE;        // turn this way immediately
  487.  
  488. // oh, this is a hack!
  489.     setmodel (self, "progs/eyes.mdl");
  490.     modelindex_eyes = self.modelindex;
  491.  
  492.     setmodel (self, "progs/player.mdl");
  493.     modelindex_player = self.modelindex;
  494.  
  495.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  496.     
  497.     self.view_ofs = '0 0 22';
  498.  
  499.     player_stand1 ();
  500.     
  501.     if (deathmatch || coop)
  502.     {
  503.         makevectors(self.angles);
  504.         spawn_tfog (self.origin + v_forward*20);
  505.     }
  506.  
  507.     spawn_tdeath (self.origin, self);
  508.  
  509. // *************************************************************************
  510. // **                                          **
  511. // ** M U L T I S K I N  1.1  (start)                                     **
  512. // **                                      **
  513. // *************************************************************************
  514.  
  515.     if (self.skin == 0) centerprint(self, "Mr. Quake himself!"); else
  516.     if (self.skin == 1) centerprint(self, "No time to play with yourself here!"); else
  517.     if (self.skin == 2) centerprint(self, "You're one pretty toad!"); else
  518.     if (self.skin == 3) centerprint(self, "Wow Stormtrooper, you're though!"); else
  519.     if (self.skin == 4) centerprint(self, "Hi Max, looking yellow/blue today!"); else
  520.     if (self.skin == 5) centerprint(self, "You are back!"); else
  521.     if (self.skin == 6) centerprint(self, "Judge Dredd! Let's restore some order!"); else
  522.     if (self.skin == 7) centerprint(self, "Camo! Can't see you, where are you!"); else
  523.     if (self.skin == 8) centerprint(self, "Okay Captain Picard, make it so!"); else
  524.     if (self.skin == 9) centerprint(self, "Whizz whizz.. Wizzard!"); else
  525.     if (self.skin == 10) centerprint(self,"I'm the Predator, you're the prey!"); else
  526.     if (self.skin == 11) centerprint(self,"Welcome Skeleton, looking good!"); else
  527.     if (self.skin == 12) centerprint(self,"Wan-Fu, whoever you are :)"); else
  528.     if (self.skin == 13) centerprint(self,"Oh no, it's Henry Rollins!"); else
  529.     if (self.skin == 14) centerprint(self,"Ooh no, it's She.. eh.. He-Man"); else
  530.     if (self.skin == 15) centerprint(self,"If it isn't Boba, go get Han Solo!"); else
  531.     if (self.skin == 16) centerprint(self,"It's SUPERMAN!"); else
  532.     if (self.skin == 17) centerprint(self,"Protect the innocent, uphold your law"); else
  533.     if (self.skin == 18) centerprint(self,"Why is that symbol on your suit?");
  534.  
  535. // *************************************************************************
  536. // **                                          **
  537. // ** M U L T I S K I N  1.1  (end)                                       **
  538. // **                                      **
  539. // *************************************************************************
  540.  
  541.  
  542. };
  543.  
  544.  
  545. /*
  546. =============================================================================
  547.  
  548.                 QUAKED FUNCTIONS
  549.  
  550. =============================================================================
  551. */
  552.  
  553.  
  554. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  555. The normal starting point for a level.
  556. */
  557. void() info_player_start =
  558. {
  559. };
  560.  
  561.  
  562. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  563. Only used on start map for the return point from an episode.
  564. */
  565. void() info_player_start2 =
  566. {
  567. };
  568.  
  569.  
  570. /*
  571. saved out by quaked in region mode
  572. */
  573. void() testplayerstart =
  574. {
  575. };
  576.  
  577. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  578. potential spawning position for deathmatch games
  579. */
  580. void() info_player_deathmatch =
  581. {
  582. };
  583.  
  584. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  585. potential spawning position for coop games
  586. */
  587. void() info_player_coop =
  588. {
  589. };
  590.  
  591. /*
  592. ===============================================================================
  593.  
  594. RULES
  595.  
  596. ===============================================================================
  597. */
  598.  
  599. void(entity c) PrintClientScore =
  600. {
  601.     if (c.frags > -10 && c.frags < 0)
  602.         bprint (" ");
  603.     else if (c.frags >= 0)
  604.     {
  605.         if (c.frags < 100)
  606.             bprint (" ");
  607.         if (c.frags < 10)
  608.             bprint (" ");
  609.     }
  610.     bprint (ftos(c.frags));
  611.     bprint (" ");
  612.     bprint (c.netname);
  613.     bprint ("\n");
  614. };
  615.  
  616. void() DumpScore =
  617. {
  618.     local entity    e, sort, walk;
  619.  
  620.     if (world.chain)
  621.         error ("DumpScore: world.chain is set");
  622.  
  623. // build a sorted lis
  624.     e = find(world, classname, "player");
  625.     sort = world;
  626.     while (e)
  627.     {
  628.         if (!sort)
  629.         {
  630.             sort = e;
  631.             e.chain = world;
  632.         }
  633.         else
  634.         {
  635.             if (e.frags > sort.frags)
  636.             {
  637.                 e.chain = sort;
  638.                 sort = e;
  639.             }
  640.             else
  641.             {
  642.                 walk = sort;
  643.                 do
  644.                 {
  645.                     if (!walk.chain)
  646.                     {
  647.                         e.chain = world;
  648.                         walk.chain = e;
  649.                     }
  650.                     else if (walk.chain.frags < e.frags)
  651.                     {
  652.                         e.chain = walk.chain;
  653.                         walk.chain = e;
  654.                     }
  655.                     else
  656.                         walk = walk.chain;
  657.                 } while (walk.chain != e);
  658.             }
  659.         }
  660.         
  661.         e = find(e, classname, "player");
  662.     }
  663.  
  664. // print the list
  665.     
  666.     bprint ("\n");    
  667.     while (sort)
  668.     {
  669.         PrintClientScore (sort);
  670.         sort = sort.chain;
  671.     }
  672.     bprint ("\n");
  673. };
  674.  
  675. /*
  676. go to the next level for deathmatch
  677. */
  678. void() NextLevel =
  679. {
  680.     local entity o;
  681.  
  682. // find a trigger changelevel
  683.     o = find(world, classname, "trigger_changelevel");
  684.     if (!o || mapname == "start")
  685.     {    // go back to same map if no trigger_changelevel
  686.         o = spawn();
  687.         o.map = mapname;
  688.     }
  689.  
  690.     nextmap = o.map;
  691.     
  692.     if (o.nextthink < time)
  693.     {
  694.         o.think = execute_changelevel;
  695.         o.nextthink = time + 0.1;
  696.     }
  697. };
  698.  
  699. /*
  700. ============
  701. CheckRules
  702.  
  703. Exit deathmatch games upon conditions
  704. ============
  705. */
  706. void() CheckRules =
  707. {
  708.     local    float        timelimit;
  709.     local    float        fraglimit;
  710.     
  711.     if (gameover)    // someone else quit the game already
  712.         return;
  713.         
  714.     timelimit = cvar("timelimit") * 60;
  715.     fraglimit = cvar("fraglimit");
  716.     
  717.     if (timelimit && time >= timelimit)
  718.     {
  719. NextLevel ();
  720. /*
  721.         gameover = TRUE;
  722.         bprint ("\n\n\n==============================\n");
  723.         bprint ("game exited after ");
  724.         bprint (ftos(timelimit/60));
  725.         bprint (" minutes\n");
  726.         DumpScore ();
  727.         localcmd ("killserver\n");
  728. */
  729.         return;
  730.     }
  731.     
  732.     if (fraglimit && self.frags >= fraglimit)
  733.     {
  734. NextLevel ();
  735. /*
  736.         gameover = TRUE;
  737.         bprint ("\n\n\n==============================\n");
  738.         bprint ("game exited after ");
  739.         bprint (ftos(self.frags));
  740.         bprint (" frags\n");
  741.         DumpScore ();
  742.         localcmd ("killserver\n");
  743. */
  744.         return;
  745.     }    
  746. };
  747.  
  748. //============================================================================
  749.  
  750. void() PlayerDeathThink =
  751. {
  752.     local entity    old_self;
  753.     local float        forward;
  754.  
  755.     if ((self.flags & FL_ONGROUND))
  756.     {
  757.         forward = vlen (self.velocity);
  758.         forward = forward - 20;
  759.         if (forward <= 0)
  760.             self.velocity = '0 0 0';
  761.         else    
  762.             self.velocity = forward * normalize(self.velocity);
  763.     }
  764.  
  765. // wait for all buttons released
  766.     if (self.deadflag == DEAD_DEAD)
  767.     {
  768.         if (self.button2 || self.button1 || self.button0)
  769.             return;
  770.         self.deadflag = DEAD_RESPAWNABLE;
  771.         return;
  772.     }
  773.  
  774. // wait for any button down
  775.     if (!self.button2 && !self.button1 && !self.button0)
  776.         return;
  777.  
  778.     self.button0 = 0;
  779.     self.button1 = 0;
  780.     self.button2 = 0;
  781.     respawn();
  782. };
  783.  
  784.  
  785. void() PlayerJump =
  786. {
  787.     local vector start, end;
  788.     
  789.     if (self.flags & FL_WATERJUMP)
  790.         return;
  791.     
  792.     if (self.waterlevel >= 2)
  793.     {
  794.         if (self.watertype == CONTENT_WATER)
  795.             self.velocity_z = 100;
  796.         else if (self.watertype == CONTENT_SLIME)
  797.             self.velocity_z = 80;
  798.         else
  799.             self.velocity_z = 50;
  800.  
  801. // play swiming sound
  802.         if (self.swim_flag < time)
  803.         {
  804.             self.swim_flag = time + 1;
  805.             if (random() < 0.5)
  806.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  807.             else
  808.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  809.         }
  810.  
  811.         return;
  812.     }
  813.  
  814.     if (!(self.flags & FL_ONGROUND))
  815.         return;
  816.  
  817.     if ( !(self.flags & FL_JUMPRELEASED) )
  818.         return;        // don't pogo stick
  819.  
  820.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  821.  
  822.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  823.     
  824.     self.button2 = 0;
  825. // player jumping sound
  826.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  827.     self.velocity_z = self.velocity_z + 270;
  828. };
  829.  
  830.  
  831. /*
  832. ===========
  833. WaterMove
  834.  
  835. ============
  836. */
  837. .float    dmgtime;
  838.  
  839. void() WaterMove =
  840. {
  841. //dprint (ftos(self.waterlevel));
  842.     if (self.movetype == MOVETYPE_NOCLIP)
  843.         return;
  844.     if (self.health < 0)
  845.         return;
  846.  
  847.     if (self.waterlevel != 3)
  848.     {
  849.         if (self.air_finished < time)
  850.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  851.         else if (self.air_finished < time + 9)
  852.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  853.         self.air_finished = time + 12;
  854.         self.dmg = 2;
  855.     }
  856.     else if (self.air_finished < time)
  857.     {    // drown!
  858.         if (self.pain_finished < time)
  859.         {
  860.             self.dmg = self.dmg + 2;
  861.             if (self.dmg > 15)
  862.                 self.dmg = 10;
  863.             T_Damage (self, world, world, self.dmg);
  864.             self.pain_finished = time + 1;
  865.         }
  866.     }
  867.     
  868.     if (!self.waterlevel)
  869.     {
  870.         if (self.flags & FL_INWATER)
  871.         {    
  872.             // play leave water sound
  873.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  874.             self.flags = self.flags - FL_INWATER;
  875.         }
  876.         return;
  877.     }
  878.  
  879.     if (self.watertype == CONTENT_LAVA)
  880.     {    // do damage
  881.         if (self.dmgtime < time)
  882.         {
  883.             if (self.radsuit_finished > time)
  884.                 self.dmgtime = time + 1;
  885.             else
  886.                 self.dmgtime = time + 0.2;
  887.  
  888.             T_Damage (self, world, world, 10*self.waterlevel);
  889.         }
  890.     }
  891.     else if (self.watertype == CONTENT_SLIME)
  892.     {    // do damage
  893.         if (self.dmgtime < time && self.radsuit_finished < time)
  894.         {
  895.             self.dmgtime = time + 1;
  896.             T_Damage (self, world, world, 4*self.waterlevel);
  897.         }
  898.     }
  899.     
  900.     if ( !(self.flags & FL_INWATER) )
  901.     {    
  902.  
  903. // player enter water sound
  904.  
  905.         if (self.watertype == CONTENT_LAVA)
  906.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  907.         if (self.watertype == CONTENT_WATER)
  908.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  909.         if (self.watertype == CONTENT_SLIME)
  910.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  911.  
  912.         self.flags = self.flags + FL_INWATER;
  913.         self.dmgtime = 0;
  914.     }
  915.     
  916.     if (! (self.flags & FL_WATERJUMP) )
  917.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  918. };
  919.  
  920. void() CheckWaterJump =
  921. {
  922.     local vector start, end;
  923.  
  924. // check for a jump-out-of-water
  925.     makevectors (self.angles);
  926.     start = self.origin;
  927.     start_z = start_z + 8; 
  928.     v_forward_z = 0;
  929.     normalize(v_forward);
  930.     end = start + v_forward*24;
  931.     traceline (start, end, TRUE, self);
  932.     if (trace_fraction < 1)
  933.     {    // solid at waist
  934.         start_z = start_z + self.maxs_z - 8;
  935.         end = start + v_forward*24;
  936.         self.movedir = trace_plane_normal * -50;
  937.         traceline (start, end, TRUE, self);
  938.         if (trace_fraction == 1)
  939.         {    // open at eye level
  940.             self.flags = self.flags | FL_WATERJUMP;
  941.             self.velocity_z = 225;
  942.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  943.             self.teleport_time = time + 2;    // safety net
  944.             return;
  945.         }
  946.     }
  947. };
  948.  
  949.  
  950. /*
  951. ================
  952. PlayerPreThink
  953.  
  954. Called every frame before physics are run
  955. ================
  956. */
  957. void() PlayerPreThink =
  958. {
  959.     local    float    mspeed, aspeed;
  960.     local    float    r;
  961.  
  962.     if (intermission_running)
  963.     {
  964.         IntermissionThink ();    // otherwise a button could be missed between
  965.         return;                    // the think tics
  966.     }
  967.  
  968.     if (self.view_ofs == '0 0 0')
  969.         return;        // intermission or finale
  970.  
  971.     makevectors (self.v_angle);        // is this still used
  972.  
  973.     CheckRules ();
  974.     WaterMove ();
  975.  
  976.     if (self.waterlevel == 2)
  977.         CheckWaterJump ();
  978.  
  979.     if (self.deadflag >= DEAD_DEAD)
  980.     {
  981.         PlayerDeathThink ();
  982.         return;
  983.     }
  984.     
  985.     if (self.deadflag == DEAD_DYING)
  986.         return;    // dying, so do nothing
  987.  
  988.     if (self.button2)
  989.     {
  990.         PlayerJump ();
  991.     }
  992.     else
  993.         self.flags = self.flags | FL_JUMPRELEASED;
  994.  
  995. // teleporters can force a non-moving pause time    
  996.     if (time < self.pausetime)
  997.         self.velocity = '0 0 0';
  998. };
  999.     
  1000. /*
  1001. ================
  1002. CheckPowerups
  1003.  
  1004. Check for turning off powerups
  1005. ================
  1006. */
  1007. void() CheckPowerups =
  1008. {
  1009.     if (self.health <= 0)
  1010.         return;
  1011.  
  1012. // invisibility
  1013.     if (self.invisible_finished)
  1014.     {
  1015. // sound and screen flash when items starts to run out
  1016.         if (self.invisible_sound < time)
  1017.         {
  1018.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  1019.             self.invisible_sound = time + ((random() * 3) + 1);
  1020.         }
  1021.  
  1022.  
  1023.         if (self.invisible_finished < time + 3)
  1024.         {
  1025.             if (self.invisible_time == 1)
  1026.             {
  1027.                 sprint (self, "Ring of Shadows magic is fading\n");
  1028.                 stuffcmd (self, "bf\n");
  1029.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  1030.                 self.invisible_time = time + 1;
  1031.             }
  1032.             
  1033.             if (self.invisible_time < time)
  1034.             {
  1035.                 self.invisible_time = time + 1;
  1036.                 stuffcmd (self, "bf\n");
  1037.             }
  1038.         }
  1039.  
  1040.         if (self.invisible_finished < time)
  1041.         {    // just stopped
  1042.             self.items = self.items - IT_INVISIBILITY;
  1043.             self.invisible_finished = 0;
  1044.             self.invisible_time = 0;
  1045.         }
  1046.         
  1047.     // use the eyes
  1048.         self.frame = 0;
  1049.         self.modelindex = modelindex_eyes;
  1050.     }
  1051.     else
  1052.         self.modelindex = modelindex_player;    // don't use eyes
  1053.  
  1054. // invincibility
  1055.     if (self.invincible_finished)
  1056.     {
  1057. // sound and screen flash when items starts to run out
  1058.         if (self.invincible_finished < time + 3)
  1059.         {
  1060.             if (self.invincible_time == 1)
  1061.             {
  1062.                 sprint (self, "Protection is almost burned out\n");
  1063.                 stuffcmd (self, "bf\n");
  1064.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1065.                 self.invincible_time = time + 1;
  1066.             }
  1067.             
  1068.             if (self.invincible_time < time)
  1069.             {
  1070.                 self.invincible_time = time + 1;
  1071.                 stuffcmd (self, "bf\n");
  1072.             }
  1073.         }
  1074.         
  1075.         if (self.invincible_finished < time)
  1076.         {    // just stopped
  1077.             self.items = self.items - IT_INVULNERABILITY;
  1078.             self.invincible_time = 0;
  1079.             self.invincible_finished = 0;
  1080.         }
  1081.         if (self.invincible_finished > time)
  1082.             self.effects = self.effects | EF_DIMLIGHT;
  1083.         else
  1084.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1085.     }
  1086.  
  1087. // super damage
  1088.     if (self.super_damage_finished)
  1089.     {
  1090.  
  1091. // sound and screen flash when items starts to run out
  1092.  
  1093.         if (self.super_damage_finished < time + 3)
  1094.         {
  1095.             if (self.super_time == 1)
  1096.             {
  1097.                 sprint (self, "Quad Damage is wearing off\n");
  1098.                 stuffcmd (self, "bf\n");
  1099.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1100.                 self.super_time = time + 1;
  1101.             }      
  1102.             
  1103.             if (self.super_time < time)
  1104.             {
  1105.                 self.super_time = time + 1;
  1106.                 stuffcmd (self, "bf\n");
  1107.             }
  1108.         }
  1109.  
  1110.         if (self.super_damage_finished < time)
  1111.         {    // just stopped
  1112.             self.items = self.items - IT_QUAD;
  1113.             self.super_damage_finished = 0;
  1114.             self.super_time = 0;
  1115.         }
  1116.         if (self.super_damage_finished > time)
  1117.             self.effects = self.effects | EF_DIMLIGHT;
  1118.         else
  1119.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1120.     }    
  1121.  
  1122. // suit    
  1123.     if (self.radsuit_finished)
  1124.     {
  1125.         self.air_finished = time + 12;        // don't drown
  1126.  
  1127. // sound and screen flash when items starts to run out
  1128.         if (self.radsuit_finished < time + 3)
  1129.         {
  1130.             if (self.rad_time == 1)
  1131.             {
  1132.                 sprint (self, "Air supply in Biosuit expiring\n");
  1133.                 stuffcmd (self, "bf\n");
  1134.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1135.                 self.rad_time = time + 1;
  1136.             }
  1137.             
  1138.             if (self.rad_time < time)
  1139.             {
  1140.                 self.rad_time = time + 1;
  1141.                 stuffcmd (self, "bf\n");
  1142.             }
  1143.         }
  1144.  
  1145.         if (self.radsuit_finished < time)
  1146.         {    // just stopped
  1147.             self.items = self.items - IT_SUIT;
  1148.             self.rad_time = 0;
  1149.             self.radsuit_finished = 0;
  1150.         }
  1151.     }    
  1152.  
  1153. };
  1154.  
  1155.  
  1156. /*
  1157. ================
  1158. PlayerPostThink
  1159.  
  1160. Called every frame after physics are run
  1161. ================
  1162. */
  1163. void() PlayerPostThink =
  1164. {
  1165.     local    float    mspeed, aspeed;
  1166.     local    float    r;
  1167.  
  1168.     if (self.view_ofs == '0 0 0')
  1169.         return;        // intermission or finale
  1170.     if (self.deadflag)
  1171.         return;
  1172.         
  1173. // do weapon stuff
  1174.  
  1175.     W_WeaponFrame ();
  1176.  
  1177. // check to see if player landed and play landing sound    
  1178.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1179.     {
  1180.         if (self.watertype == CONTENT_WATER)
  1181.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1182.         else if (self.jump_flag < -650)
  1183.         {
  1184.             T_Damage (self, world, world, 5); 
  1185.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1186.             self.deathtype = "falling";
  1187.         }
  1188.         else
  1189.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1190.  
  1191.         self.jump_flag = 0;
  1192.     }
  1193.  
  1194.     if (!(self.flags & FL_ONGROUND))
  1195.         self.jump_flag = self.velocity_z;
  1196.  
  1197.     CheckPowerups ();
  1198. };
  1199.  
  1200.  
  1201. /*
  1202. ===========
  1203. ClientConnect
  1204.  
  1205. called when a player connects to a server
  1206. ============
  1207. */
  1208. void() ClientConnect =
  1209. {
  1210.     bprint (self.netname);
  1211.     bprint (" entered the game\n");
  1212.     
  1213. // a client connecting during an intermission can cause problems
  1214.     if (intermission_running)
  1215.         ExitIntermission ();
  1216. };
  1217.  
  1218.  
  1219. /*
  1220. ===========
  1221. ClientDisconnect
  1222.  
  1223. called when a player disconnects from a server
  1224. ============
  1225. */
  1226. void() ClientDisconnect =
  1227. {
  1228.     if (gameover)
  1229.         return;
  1230.     // if the level end trigger has been activated, just return
  1231.     // since they aren't *really* leaving
  1232.  
  1233.     // let everyone else know
  1234.     bprint (self.netname);
  1235.     bprint (" left the game with ");
  1236.     bprint (ftos(self.frags));
  1237.     bprint (" frags\n");
  1238.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1239.     set_suicide_frame ();
  1240. };
  1241.  
  1242. /*
  1243. ===========
  1244. ClientObituary
  1245.  
  1246. called when a player dies
  1247. ============
  1248. */
  1249. void(entity targ, entity attacker) ClientObituary =
  1250. {
  1251.     local    float rnum;
  1252.     local    string deathstring, deathstring2;
  1253.     rnum = random();
  1254.  
  1255.     if (targ.classname == "player")
  1256.     {
  1257.         if (attacker.classname == "teledeath")
  1258.         {
  1259.             bprint (targ.netname);
  1260.             bprint (" was telefragged by ");
  1261.             bprint (attacker.owner.netname);
  1262.             bprint ("\n");
  1263.  
  1264.             attacker.owner.frags = attacker.owner.frags + 1;
  1265.             return;
  1266.         }
  1267.  
  1268.         if (attacker.classname == "teledeath2")
  1269.         {
  1270.             bprint ("Satan's power deflects ");
  1271.             bprint (targ.netname);
  1272.             bprint ("'s telefrag\n");
  1273.  
  1274.             targ.frags = targ.frags - 1;
  1275.             return;
  1276.         }
  1277.  
  1278.         if (attacker.classname == "player")
  1279.         {
  1280.             if (targ == attacker)
  1281.             {
  1282.                 // killed self
  1283.                 attacker.frags = attacker.frags - 1;
  1284.                 bprint (targ.netname);
  1285.                 
  1286.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1287.                 {
  1288.                     bprint (" discharges into the water.\n");
  1289.                     return;
  1290.                 }
  1291.                 if (targ.weapon == 16)
  1292.                     bprint (" tries to put the pin back in\n");
  1293.                 else if (rnum)
  1294.                     bprint (" becomes bored with life\n");
  1295.                 else
  1296.                     bprint (" checks if his weapon is loaded\n");
  1297.                 return;
  1298.             }
  1299.             else
  1300.             {
  1301.                 attacker.frags = attacker.frags + 1;
  1302.  
  1303.                 rnum = attacker.weapon;
  1304.                 if (rnum == IT_AXE)
  1305.                 {
  1306.                     deathstring = " was ax-murdered by ";
  1307.                     deathstring2 = "\n";
  1308.                 }
  1309.                 if (rnum == IT_SHOTGUN)
  1310.                 {
  1311.                     deathstring = " chewed on ";
  1312.                     deathstring2 = "'s boomstick\n";
  1313.                 }
  1314.                 if (rnum == IT_SUPER_SHOTGUN)
  1315.                 {
  1316.                     deathstring = " ate 2 loads of ";
  1317.                     deathstring2 = "'s buckshot\n";
  1318.                 }
  1319.                 if (rnum == IT_NAILGUN)
  1320.                 {
  1321.                     deathstring = " was nailed by ";
  1322.                     deathstring2 = "\n";
  1323.                 }
  1324.                 if (rnum == IT_SUPER_NAILGUN)
  1325.                 {
  1326.                     deathstring = " was punctured by ";
  1327.                     deathstring2 = "\n";
  1328.                 }
  1329.                 if (rnum == IT_GRENADE_LAUNCHER)
  1330.                 {
  1331.                     deathstring = " eats ";
  1332.                     deathstring2 = "'s pineapple\n";
  1333.                     if (targ.health < -40)
  1334.                     {
  1335.                         deathstring = " was gibbed by ";
  1336.                         deathstring2 = "'s grenade\n";
  1337.                     }
  1338.                 }
  1339.                 if (rnum == IT_ROCKET_LAUNCHER)
  1340.                 {
  1341.                     deathstring = " rides ";
  1342.                     deathstring2 = "'s rocket\n";
  1343.                     if (targ.health < -40)
  1344.                     {
  1345.                         deathstring = " was gibbed by ";
  1346.                         deathstring2 = "'s rocket\n" ;
  1347.                     }
  1348.                 }
  1349.                 if (rnum == IT_LIGHTNING)
  1350.                 {
  1351.                     deathstring = " accepts ";
  1352.                     if (attacker.waterlevel > 1)
  1353.                         deathstring2 = "'s discharge\n";
  1354.                     else
  1355.                         deathstring2 = "'s shaft\n";
  1356.                 }
  1357.                 bprint (targ.netname);
  1358.                 bprint (deathstring);
  1359.                 bprint (attacker.netname);
  1360.                 bprint (deathstring2);
  1361.             }
  1362.             return;
  1363.         }
  1364.         else
  1365.         {
  1366.             targ.frags = targ.frags - 1;        // killed self
  1367.             rnum = targ.watertype;
  1368.  
  1369.             bprint (targ.netname);
  1370.             if (rnum == -3)
  1371.             {
  1372.                 if (random() < 0.5)
  1373.                     bprint (" sleeps with the fishes\n");
  1374.                 else
  1375.                     bprint (" sucks it down\n");
  1376.                 return;
  1377.             }
  1378.             else if (rnum == -4)
  1379.             {
  1380.                 if (random() < 0.5)
  1381.                     bprint (" gulped a load of slime\n");
  1382.                 else
  1383.                     bprint (" can't exist on slime alone\n");
  1384.                 return;
  1385.             }
  1386.             else if (rnum == -5)
  1387.             {
  1388.                 if (targ.health < -15)
  1389.                 {
  1390.                     bprint (" burst into flames\n");
  1391.                     return;
  1392.                 }
  1393.                 if (random() < 0.5)
  1394.                     bprint (" turned into hot slag\n");
  1395.                 else
  1396.                     bprint (" visits the Volcano God\n");
  1397.                 return;
  1398.             }
  1399.  
  1400.             if (attacker.flags & FL_MONSTER)
  1401.             {
  1402.                 if (attacker.classname == "monster_army")
  1403.                     bprint (" was shot by a Grunt\n");
  1404.                 if (attacker.classname == "monster_demon1")
  1405.                     bprint (" was eviscerated by a Fiend\n");
  1406.                 if (attacker.classname == "monster_dog")
  1407.                     bprint (" was mauled by a Rottweiler\n");
  1408.                 if (attacker.classname == "monster_dragon")
  1409.                     bprint (" was fried by a Dragon\n");
  1410.                 if (attacker.classname == "monster_enforcer")
  1411.                     bprint (" was blasted by an Enforcer\n");
  1412.                 if (attacker.classname == "monster_fish")
  1413.                     bprint (" was fed to the Rotfish\n");
  1414.                 if (attacker.classname == "monster_hell_knight")
  1415.                     bprint (" was slain by a Death Knight\n");
  1416.                 if (attacker.classname == "monster_knight")
  1417.                     bprint (" was slashed by a Knight\n");
  1418.                 if (attacker.classname == "monster_ogre")
  1419.                     bprint (" was destroyed by an Ogre\n");
  1420.                 if (attacker.classname == "monster_oldone")
  1421.                     bprint (" became one with Shub-Niggurath\n");
  1422.                 if (attacker.classname == "monster_shalrath")
  1423.                     bprint (" was exploded by a Vore\n");
  1424.                 if (attacker.classname == "monster_shambler")
  1425.                     bprint (" was smashed by a Shambler\n");
  1426.                 if (attacker.classname == "monster_tarbaby")
  1427.                     bprint (" was slimed by a Spawn\n");
  1428.                 if (attacker.classname == "monster_vomit")
  1429.                     bprint (" was vomited on by a Vomitus\n");
  1430.                 if (attacker.classname == "monster_wizard")
  1431.                     bprint (" was scragged by a Scrag\n");
  1432.                 if (attacker.classname == "monster_zombie")
  1433.                     bprint (" joins the Zombies\n");
  1434.  
  1435.                 return;
  1436.             }
  1437.             if (attacker.classname == "explo_box")
  1438.             {
  1439.                 bprint (" blew up\n");
  1440.                 return;
  1441.             }
  1442.             if (attacker.solid == SOLID_BSP && attacker != world)
  1443.             {    
  1444.                 bprint (" was squished\n");
  1445.                 return;
  1446.             }
  1447.             if (targ.deathtype == "falling")
  1448.             {
  1449.                 targ.deathtype = "";
  1450.                 bprint (" fell to his death\n");
  1451.                 return;
  1452.             }
  1453.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1454.             {
  1455.                 bprint (" was spiked\n");
  1456.                 return;
  1457.             }
  1458.             if (attacker.classname == "fireball")
  1459.             {
  1460.                 bprint (" ate a lavaball\n");
  1461.                 return;
  1462.             }
  1463.             if (attacker.classname == "trigger_changelevel")
  1464.             {
  1465.                 bprint (" tried to leave\n");
  1466.                 return;
  1467.             }
  1468.  
  1469.             bprint (" died\n");
  1470.         }
  1471.     }
  1472. };
  1473.